forum

home / developersection / forums / how to random.choice equivalent in java for an array?

How to Random.choice Equivalent in Java for an Array?

Pravesh Singh 2612 04-Nov-2014

Here is an example of my random.choice implementation in Python.

available_cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'TeamLeader', 'Rohit', 'Kesharwani', 'Alld']
random_computer_card = random.choice(available_cards)
print random_computer_card

Just wondering what the Java equivalent would be for this piece of code. Obviously, I haven't included the import statement in the sample.


Updated on 04-Nov-2014
Can you answer this question?

Answer

1 Answers

Liked By